#include "BFilter.h"
#include "Calculate.h"

#include <iostream>
#include <string>
int main(int argc, char** argv) {
	size_t n = 1000;
	double p = 0.01;

	size_t m = calculate_m(n, p);
	size_t k = calculate_k(m, n);

	std::cout << "m (bitArray size) = " << m << std::endl;
	std::cout << "k (hash size) = " << k << std::endl;

	BFilter<std::string> BF(m, n);

	BF.add("orange");
	BF.add("apple");
	BF.add("banana");
	BF.add("lemon");
	BF.add("pear");
	BF.add("peach");

	std::vector<std::string> Fruits =
	{
		"orange",
		"leomn",
		"cat",
		"pear",
		"peach"
	};

	for (auto e : Fruits) {
		std::cout << e + " in Database ? " << BF.iscontain(e) << std::endl;
	}

	return 0;
}